package fr.enssat.embeddedsoft.projet.fgourvel.spotrin;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

public class ScoreView extends View {
	
	// Paint
	private Paint m_Paint = new Paint(Paint.ANTI_ALIAS_FLAG);

	// Score du joueur incarnant le sumo rouge
	private int m_RedScore = 0;
	
	// Score du joueur incarnant le sumo blanc
	private int m_WhiteScore = 0;
	
	// Constructeurs
	public ScoreView(Context context){
		super(context);
	}
	
	public ScoreView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public ScoreView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	// Accesseur en ecriture
	public void incrementRedScore() {
		m_RedScore++;
		invalidate();
	}
	
	public void incrementWhiteScore() {
		m_WhiteScore++;
		invalidate();
	}
	
	public void onDraw(Canvas canvas){
		m_Paint.setColor(Color.WHITE);
		canvas.drawText("Score :", 0, 10, m_Paint);
		canvas.drawText("Rouge : " + m_RedScore, 0, 25, m_Paint);
		canvas.drawText("Blanc : " + m_WhiteScore, 0, 40, m_Paint);
	}
}
